<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <script>
        var arr = [1, 2, 3, 4];
        // arr[arr.length] = "afasf"; //向末尾添加一项
        // arr[arr.length] = "afasf1"; //向末尾添加一项
        // arr[arr.length] = "afasf2"; //向末尾添加一项
        // arr[arr.length] = "afasf3"; //向末尾添加一项

        // arr.push("abc", "bcd");
        // arr.push("bcd");
        // arr.push({
        //     name: "Adsf",
        //     age: 18
        // });
        // console.log(arr);
        // arr.unshift(1, 2, 3);

        arr.splice(2, 0, "abc", "bcd");
        console.log(arr);
    </script>
</body>

</html>
